package com.tongxin.van.frameworkcanary.utils;

import android.content.Context;
import android.support.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;

import java.io.InputStream;

/**
 *
 * author: VanyLiu
 * email: 13212674795@163.com
 * description:Glide引入Okhttp作为网络请求框架
 *
**/
@GlideModule
public class OkhttpGlideModule extends AppGlideModule {

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        registry.replace(GlideUrl.class,InputStream.class, new OkHttpUrlLoader.Factory());
    }
}
